public class Text5 {
    public static void main(String[] args) {
        int[] nums={2,7,11,15};
        int  target = 9;
        fun(nums,target);
    }
    public static void fun(int[] nums,int n){
        for (int i = 0; i < nums.length; i++) {
            for (int j = nums.length-1; j > i; j--) {
                if(nums[i]+nums[j]==n){
                    System.out.println("["+i+","+j+"]");
                }
            }
        }
    }
}
